/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bean;

import entity.Mobile;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author TUANNK
 */
@Stateless
public class MobileFacade extends AbstractFacade<Mobile> implements MobileFacadeLocal {
    @PersistenceContext(unitName = "14_Mobile-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public MobileFacade() {
        super(Mobile.class);
    }

    @Override
    public List<Mobile> searchByPrice(int min, int max) {
        Query q = em.createNamedQuery("Mobile.findByPrice");
        q.setParameter("min", min);
        q.setParameter("max", max);
        return q.getResultList();
    }
    
}
